﻿using UnityEngine;


public class SwordsmanBehaviorScoreModeBest : MonsterBehaviorScoreModeBest<SwordsmanBehaviorModeBest>
{
    protected Swordsman swordsman;
    protected int thumpAttackPriority = 5;
    protected int stabAttackPriority = 6;


    protected override void Awake()
    {
        base.Awake();
        behaviors.Add(ThumpAttackBehaviorScore, behaviorMode.ThumpAttackBehavior);
        behaviors.Add(StabAttackBehaviorScore, behaviorMode.StabAttackBehavior);
        swordsman = GetComponent<Swordsman>();
    }


    public int ThumpAttackBehaviorScore()
    {
        int score = 0;
        GameObject targetPlayer = behaviorMode.GetAttackTargetPlayer();
        if (targetPlayer != null && (swordsman.IsGround || !swordsman.IsInNormalAttackCD()))
        {
            score += thumpAttackPriority;
        }
        return score;
    }


    public int StabAttackBehaviorScore()
    {
        int score = 0;
        GameObject target = behaviorMode.GetTargetPlayer();
        if (target != null && swordsman.IsGround && !swordsman.IsInStabAttackCD() && Mathf.Abs(target.transform.position.y - swordsman.transform.position.y) <= 1.0f)
        {
            score += stabAttackPriority;
        }
        return score;
    }
}
